package org.feidao.chapter61.service;

import lombok.extern.slf4j.Slf4j;
import org.feidao.chapter61.common.MqttPublisher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class MqttService {
    @Autowired
    MqttPublisher mqttPublisher;

    public void sendMqttMessage(String topic, String message){
        try {
            mqttPublisher.sendMessage(topic, message);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
